﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SingleSigon.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.SingleSigon" %>


<%
    if (Request["ByService"] == "true")
    {
		//using (var gas = new GerpAuthenServiceClient())
		//{
		//	Dictionary<string, string> result = gas.GetUserTempInfo(Request["token"]);

		//	new SsMng().SetLoginSession(
		//		result["UserSeq"],
		//		result["EmpSeq"],
		//		result["UserName"],
		//		result["WorkingJobSiteSeq"],
		//		result["Height"], false);
		//}

		//var redirectPage = Server.UrlDecode(HttpContext.Current.Request["redirectPage"]);

		//if (string.IsNullOrEmpty(redirectPage)) redirectPage = "/App_UI/Forms/Default.aspx";

		//HttpContext.Current.Response.Redirect(redirectPage);
    }
    else
    {
        HttpCookie cookieUserDetail = HttpContext.Current.Request.Cookies["UserDetail"];
        //try
        //{
            new SsMng().SetLoginSession(
                cookieUserDetail["UserSeq"].ToString(),
                cookieUserDetail["EmpSeq"].ToString(),
                cookieUserDetail["UserName"] == null? "" : cookieUserDetail["UserName"].ToString(),
                cookieUserDetail["WorkingJobSiteSeq"] == null ? null : cookieUserDetail["WorkingJobSiteSeq"].ToString(),
                cookieUserDetail["Height"] == null ? "550" : cookieUserDetail["Height"].ToString(),
                false);

            HttpContext.Current.Response.Redirect(HttpContext.Current.Request["redirectPage"].Replace("|", "&") + "&Editable=0");
        //} catch (Exception ex)
        //{
        //    throw new Exception("Data share between module is no value.\r\n" +
        //    "cookieUserDetail is " + (cookieUserDetail == null ? "null":"") + "\r\n" +
        //    "UserSeq is " + (cookieUserDetail != null ? cookieUserDetail["UserSeq"] : "")+ "\r\n" +
        //    "EmpSeq is " + (cookieUserDetail != null ? cookieUserDetail["EmpSeq"] : "")+ "\r\n" +
        //    "UserName is " + (cookieUserDetail != null ? cookieUserDetail["UserName"] : "")+ "\r\n" +
        //    "WorkingJobSiteSeq is " + (cookieUserDetail != null ? cookieUserDetail["WorkingJobSiteSeq"] : "")+ "\r\n");//+
        //    //"Height is " + (cookieUserDetail != null ? cookieUserDetail["Height"] : "")+ "\r\n")
        //}
    }
%>